JBoss Community Archive (Read Only)

Graphene 1

Getting Started

Graphene strongly ties to Arquillian Core and its extensions Containers and Drone to manage lifecycle of the application server, selenium server and Graphene.

In the common scenarios, you need only to choose container you would like to deploy application into and the framework you would like to use for testing.

Test Frameworks Options

In case of Java testing frameworks, you can choose between

  • JUnit

  • TestNG

and use appropriate dependency chain in your Maven POM as you can see bellow

Arquillian Mode Options

You can choose between following Arquillian modes:

  • Standalone

    • runs tests without container integration, only lifecycle of extensions is managed

  • Container

    • runs tests with container, managed lifecycle of container including deployment

and use appropriate dependency chain in your Maven as you can see bellow.

JUnit Standalone

<!-- JUnit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.2</version>
    <scope>test</scope>
</dependency>

<!-- Arquillian JUnit Standalone -->
<dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-standalone</artifactId>
    <version>1.0.0.Final</version>
    <scope>test</scope>
</dependency>

<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>arquillian-graphene</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
    <scope>test</scope>
</dependency>

JUnit Container

<!-- JUnit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.2</version>
    <scope>test</scope>
</dependency>

<!-- Arquillian JUnit Container -->
<dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-container</artifactId>
    <version>1.0.0.Final</version>
    <scope>test</scope>
</dependency>

<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>arquillian-graphene</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
    <scope>test</scope>
</dependency>

TestNG Standalone

<!-- TestNG -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>5.14.6</version>
    <scope>test</scope>
</dependency>

<!-- Arquillian TestNG Standalone -->
<dependency>
    <groupId>org.jboss.arquillian.testng</groupId>
    <artifactId>arquillian-testng-standalone</artifactId>
    <version>1.0.0.Final</version>
    <scope>test</scope>
</dependency>


<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>arquillian-graphene</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
    <scope>test</scope>
</dependency>

TestNG Container

<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.14.6</version>
<scope>test</scope>
</dependency>

<!-- Arquillian TestNG Container -->
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<version>1.0.0.Final</version>
<scope>test</scope>
</dependency>

<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>arquillian-graphene</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>test</scope>
</dependency>

These dependencies will make available all of the following dependencies:

  • JUnit/TestNG

  • Arquillian JUnit/TestNG Standalone/Container

  • Arquillian Graphene

    • API / Impl

  • Arquillian Drone

    •  API / Impl

    • Selenium Server

  • Selenium Server

    • SLF4J (required by server)

All of the dependencies manages their required versions.

Although you can manage them and override versions in your project, however there are no guarantee all of the features will work as expected when doing so.

Starting with testing from Java

The sample Graphene test can look like this one:

@RunWith(Arquillian.class)
public class BasicTestCase {

    URL url = URLUtils.buildUrl("http://www.google.com/");

    @Drone
    GrapheneSelenium browser;

    @Test
    public void testOpeningHomePage() {
        browser.open(url);
    }
}

Other Samples of Usage

For complete sample of usage, you can inspect functional test of Graphene:

  • Maven POM

    • arquillian-graphene dependency

    • container dependency

  • arquillian.xml

    • container settings

    • selenium server settings

    • Graphene settings

  • Sample Test and its Abstract Part

    • @Drone GrapheneSelenium selenium;

    • @ArquillianResource URL applicationPath;

    • @Deployment static WebArchive createDeployment();

    • @Test void test();

Application Container Options

Arquillian has been chosen as suitable container for running Selenium tests since it provides support of managing application servers and deployments.

Refer Arquillian Documentation for complete reference of Arquillian Core and specifically Container adapters.

You will need to define container dependencies and setup arquillian.xml.

Using Drone

Drone is extension for Arquillian that manages lifecycle of the Selenium Server and Selenium clients as Selenium 1.x, Selenium 2.x and Graphene.

For using Drone, refer to Drone Extension Documentation.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 12:13:26 UTC, last content change 2012-04-11 13:22:02 UTC.